package main

import "fmt"

func lengthOfLongestSubstring(s string) int {
	res := 0
	n := len(s)
	dic := make(map[byte]bool)
	for i := 0; i < n; i++ {
		if _, ok := dic[s[i]]; ok {
			dic = make(map[byte]bool)
			dic[s[i]] = true
		} else {
			dic[s[i]] = true
			res = max(res, len(dic))
			fmt.Println(string(s[i]))
		}
	}
	return res
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func main() {
	fmt.Println(lengthOfLongestSubstring("dvdf"))
}
